﻿<Window x:Class="SampleApplication.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window1"
        Height="900"
        Width="900"
        xmlns:DShow="clr-namespace:WPFMediaKit.DirectShow.Controls;assembly=WPFMediaKit"
        x:Name="mainWindow" Background="Black" Foreground="White">
    <Window.Resources>
        <DShow:MediaTimeToSeconds x:Key="MediaTimeToSeconds" />
    </Window.Resources>
    <Grid x:Name="root">
        <Grid Margin="0,0,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.5*" />
                <ColumnDefinition Width="0.5*" />
            </Grid.ColumnDefinitions>
            <DShow:MediaUriElement x:Name="mediaPlayer"
                                   Width="Auto"
                                   Height="Auto"
                                   LoadedBehavior="Play"
                                   UnloadedBehavior="Close"
                                   PreferedPositionFormat="Frame"
                                   Volume="1"
                                   AudioRenderer="{Binding Path=SelectedItem, ElementName=audioDevices}"
                                   Stretch="Uniform" 
                                   VideoRenderer="VideoMixingRenderer9" />
            <StackPanel HorizontalAlignment="Left"
                        VerticalAlignment="Top"
                        Background="#55ffffff">
                <Menu Width="471.303333333333">
                    <MenuItem Header="_File">
                        <MenuItem Header="_Open"
                                  x:Name="mnuOpen"
                                  Click="mnuOpen_Click" />
                    </MenuItem>
                </Menu>
                <StackPanel Orientation="Horizontal">
                    <Label Content="Deep Color" />
                    <CheckBox IsChecked="{Binding ElementName=mediaPlayer, Path=DeeperColor}" />
                    <Label Content="Loop" />
                    <CheckBox IsChecked="{Binding Path=Loop, ElementName=mediaPlayer}" />
                </StackPanel>
                <ListBox x:Name="audioDevices"
                         ItemsSource="{Binding Source={x:Static DShow:MultimediaUtil.AudioRendererNames}}"
                         Foreground="Black"
                         FontSize="20"
                         VerticalAlignment="Top"
                         Margin="0, 30, 0,0"
                         Width="400"
                         Height="80"
                         ScrollViewer.HorizontalScrollBarVisibility="Hidden" />
                <Slider x:Name="rateSlider"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Top"
                        Orientation="Horizontal"
                        Width="300"
                        SmallChange="0.3"
                        LargeChange="1"
                        Value="{Binding Path=SpeedRatio, ElementName=mediaPlayer}"
                        Minimum="0"
                        Maximum="10" />
                <StackPanel Orientation="Horizontal">
                    <Label Content="Position Format: " />
                    <Label Content="{Binding Path=CurrentPositionFormat, ElementName=mediaPlayer}" />
                    <Label Content="0" />
                    <Slider x:Name="positionSlider"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Top"
                            Orientation="Horizontal"
                            Width="300"
                            SmallChange="0.01"
                            LargeChange="1"
                            Value="{Binding Path=MediaPosition, ElementName=mediaPlayer}"
                            Maximum="{Binding Path=MediaDuration, ElementName=mediaPlayer}">
                        <Slider.ToolTip>
                            <MultiBinding Converter="{StaticResource MediaTimeToSeconds}">
                                <Binding ElementName="mediaPlayer" />
                                <Binding ElementName="mediaPlayer"
                                         Path="MediaPosition" />
                            </MultiBinding>
                        </Slider.ToolTip>
                    </Slider>
                    <Label>
                        <MultiBinding Converter="{StaticResource MediaTimeToSeconds}">
                            <Binding ElementName="mediaPlayer" />
                            <Binding ElementName="mediaPlayer"
                                     Path="MediaDuration" />
                        </MultiBinding>
                    </Label>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Button Content="Play"
                            Click="playButton_Click"
                            x:Name="playButton" />
                    <Button Content="Pause"
                            Click="pauseButton_Click"
                            x:Name="pauseButton" />
                </StackPanel>
                <Button Content="Don't Click"
                        Width="40"
                        Height="40"
                        Click="Button_Click" />
            </StackPanel>
            <StackPanel Grid.Column="1"
                        Margin="0,0,0,0">
                <StackPanel Orientation="Vertical"
                            Width="Auto"
                            Height="Auto">

					<DShow:VideoCaptureElement x:Name="videoCapElement"
                                               LoadedBehavior="Play"
                                               DesiredPixelWidth="320"
                                               DesiredPixelHeight="240"
                                               Stretch="Fill"
                                               VideoCaptureDevice="{Binding Path=SelectedItem, ElementName=videoCapDevices}"
                                               FPS="30" EnableSampleGrabbing="True" />


					<ComboBox x:Name="videoCapDevices"
							  ItemsSource="{Binding Source={x:Static DShow:MultimediaUtil.VideoInputDevices}}" 
							  DisplayMemberPath="Name"
							  Foreground="Black" FontSize="20" VerticalAlignment="Top" Margin="0, 30, 0,0" />

					<DShow:VideoCaptureElement x:Name="videoCapElement1"
                                               LoadedBehavior="Play"
                                               DesiredPixelWidth="320"
                                               DesiredPixelHeight="240"
                                               Stretch="Fill"
                                               VideoCaptureDevice="{Binding Path=SelectedItem, ElementName=videoCapDevices1}"
                                               FPS="30" />

					<ComboBox x:Name="videoCapDevices1"
							  ItemsSource="{Binding Source={x:Static DShow:MultimediaUtil.VideoInputDevices}}" 
							  DisplayMemberPath="Name"
							  Foreground="Black" FontSize="20" VerticalAlignment="Top" Margin="0, 30, 0,0" />
					<!-- ListBox x:Name="videoCapDevices"
                             SelectedIndex="0"
                             ItemsSource="{Binding Source={x:Static DShow:MultimediaUtil.VideoInputNames}}"
                             Foreground="Black"
                             FontSize="20"
                             VerticalAlignment="Top"
                             Margin="0, 30, 0,0"
                             ScrollViewer.HorizontalScrollBarVisibility="Hidden" / -->
                </StackPanel>
            </StackPanel>
            <GridSplitter HorizontalAlignment="Right"
                          VerticalAlignment="Stretch"
                          Width="5"
                          Height="Auto"
                          VerticalContentAlignment="Top" />
        </Grid>
    </Grid>
</Window>
